cd "regression_data/regression_data.dta"
* This code includes all the tables in the main manuscript and online appendix except Table A.7 which is generated
* using R. 
*********************************************************************************

* Table 1. marginal value of water in the lake
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)
gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92


reg     tolls monthly_lake_level_2 fac_112 fac_132                  fac_seas1
newey   tolls monthly_lake_level_2 fac_112 fac_132                  fac_seas1, lag(4)
outreg2 using subs_for_Table_1.xls, replace ctitle(OLS) label addstat("F-statistic", e(F))
ivreg2 tolls fac_112  fac_132                  fac_seas1 ( monthly_lake_level_2 = m_1_lagged_rainfall_lake), endog( monthly_lake_level_2) robust bw(auto) small gmm2s
outreg2 using subs_for_Table_1.xls, append ctitle(2SLS) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 tolls fac_seas1 fac_year2 fac_year3 fac_year4 fac_year5 fac_year6 fac_year7 fac_year8 fac_year9 fac_year10 fac_year11 (monthly_lake_level_2 = m_1_lagged_rainfall_lake), endog( monthly_lake_level_2) robust bw(auto) small gmm2s
outreg2 using subs_for_Table_1.xls, append ctitle(2SLS) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 tolls fac_112  fac_132 dummy_preinvest1 fac_seas1 ( monthly_lake_level_2 = m_1_lagged_rainfall_lake), endog( monthly_lake_level_2) robust bw(auto) small gmm2s
outreg2 using subs_for_Table_1.xls, append ctitle(2SLS) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

*********************************************************************************

* Table 2. interaction term
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tolls    monthly_lake_level_2 intlake fac_112  fac_132 fac_seas1
newey   tolls    monthly_lake_level_2 intlake fac_112  fac_132 fac_seas1, lag(4)
outreg2 using    Table_2.xls, replace ctitle(Tolls OLS) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_112  fac_132 fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_2.xls, append ctitle(Tolls IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

* these are used for confidence interval and partial identification

nlcom (_b[intlake]/_b[monthly_lake_level_2])

nlcom (monthly_lake:_b[monthly_lake_level_2]) (intearction:_b[intlake]) (ratio:_b[intlake]/_b[monthly_lake_level_2])
mat list r(V)

* back to Table 2:

ivreg2 tonnage fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_2.xls, append ctitle(Tonnage IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 transits fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_2.xls, append ctitle(Transits IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

nlcom (-(_b[intlake]/_b[monthly_lake_level_2]) * _b[monthly_lake_level_2] * 208000 * 2.6 * 10^(-9))/(.023 + _b[monthly_lake_level_2] * 208000 * 2.6 * 10^(-9))


drop if time_trend_monthly > 92
ivreg2 transits fac_112 fac_132 fac_seas1 ( monthly_lake_level_2 = m_1_lagged_rainfall_lake ), endog( monthly_lake_level_2) robust bw(auto) small gmm2s
outreg2 using    Table_2.xls, append ctitle(IV tolls pre) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))



*********************************************************************************

* Table 3. Year FE tolls

use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1


* with year FE ------ the second two columns are in there
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tolls    monthly_lake_level_2 intlake fac_year* fac_seas1
newey   tolls    monthly_lake_level_2 intlake fac_year* fac_seas1, lag(4)
outreg2 using    Table_3.xls, replace ctitle(Tolls OLS original) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_year* fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_year* fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_3.xls, append ctitle(Tolls IV year FE) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


* with year FE but without 2017 specific FE
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)
tab year_2 , gen(fac_year_2)
tab year_3 , gen(fac_year_3)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tolls    monthly_lake_level_2 intlake fac_year_3* fac_seas1
newey   tolls    monthly_lake_level_2 intlake fac_year_3* fac_seas1, lag(4)
outreg2 using    Table_3.xls, append ctitle(Tolls OLS year FE alt_FE_1) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_year_3* fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_year_3* fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_3.xls, append ctitle(Tolls IV year FE alt_FE_1) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


* with year FE but broken down at the expansion point
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)
tab year_2 , gen(fac_year_2)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tolls    monthly_lake_level_2 intlake fac_year_2* fac_seas1
newey   tolls    monthly_lake_level_2 intlake fac_year_2* fac_seas1, lag(4)
outreg2 using    Table_3.xls, append ctitle(Tolls OLS year FE alt_FE_2) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_year_2* fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_year_2* fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_3.xls, append ctitle(Tolls IV year FE alt_FE_2) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

*********************************************************************************

* Table A1. Expansion dummy and tonnage
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)

gen intlake    = monthly_lake_level_2     * dummy_preinvest1

reg     tolls    dummy_preinvest1 fac_112  fac_132 fac_seas1
newey   tolls    dummy_preinvest1 fac_112  fac_132 fac_seas1, lag(4)
outreg2 using    Table_a1.xls, replace  ctitle(OLS) label addstat("F-statistic", e(F))

ivreg2 tolls fac_112 fac_132 dummy_preinvest1 fac_seas1 (monthly_lake_level_2 = m_1_lagged_rainfall_lake), robust bw(auto) small gmm2s
outreg2 using    Table_a1.xls, append ctitle(IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 tolls fac_112 fac_132 dummy_preinvest1 fac_seas1 tonnage (monthly_lake_level_2 = m_1_lagged_rainfall_lake), robust bw(auto) small gmm2s
outreg2 using    Table_a1.xls, append ctitle(IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


*********************************************************************************

* Table A2. Transits over 91ft
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tolls    monthly_lake_level_2 intlake fac_112  fac_132 fac_seas1 transit_over_91
newey   tolls    monthly_lake_level_2 intlake fac_112  fac_132 fac_seas1 transit_over_91, lag(4)
outreg2 using    Table_a2.xls, replace ctitle(Tolls OLS) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_112  fac_132 fac_seas1 transit_over_91
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_112 fac_132 fac_seas1 transit_over_91 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a2.xls, append ctitle(Tolls IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


ivreg2 tonnage fac_112 fac_132 fac_seas1 transit_over_91 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a2.xls, append ctitle(Tonnage IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

*********************************************************************************
* Table A3. Year FE tonnage

* with year FE
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tonnage    monthly_lake_level_2 intlake fac_year* fac_seas1
newey   tonnage    monthly_lake_level_2 intlake fac_year* fac_seas1, lag(4)
outreg2 using    Table_a3.xls, replace ctitle(Tolls OLS year FE) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_year* fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tonnage fac_year* fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a3.xls, append ctitle(Tolls IV year FE) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


* with year FE but broken down at the expansion point
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)
tab year_3 , gen(fac_year_3)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tonnage    monthly_lake_level_2 intlake fac_year_3* fac_seas1
newey   tonnage    monthly_lake_level_2 intlake fac_year_3* fac_seas1, lag(4)
outreg2 using    Table_a3.xls, append ctitle(Tolls OLS year FE alt_FE_1) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_year_3* fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tonnage fac_year_3* fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a3.xls, append ctitle(Tolls IV year FE alt_FE_1) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


* with year FE but broken down at the expansion point
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)
tab year_2 , gen(fac_year_2)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tonnage    monthly_lake_level_2 intlake fac_year_2* fac_seas1
newey   tonnage    monthly_lake_level_2 intlake fac_year_2* fac_seas1, lag(4)
outreg2 using    Table_a3.xls, append ctitle(Tolls OLS year FE alt_FE_2) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_year_2* fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tonnage fac_year_2* fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a3.xls, append ctitle(Tolls IV year FE alt_FE_2) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


*********************************************************************************
* Table A4. Year FE transits

* with year FE
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     transits    monthly_lake_level_2 intlake fac_year* fac_seas1
newey   transits    monthly_lake_level_2 intlake fac_year* fac_seas1, lag(4)
outreg2 using    Table_a4.xls, replace ctitle(Tolls OLS year FE) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_year* fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 transits fac_year* fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a4.xls, append ctitle(Tolls IV year FE) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


* with year FE but broken down at the expansion point
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)
tab year_3 , gen(fac_year_3)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     transits    monthly_lake_level_2 intlake fac_year_3* fac_seas1
newey   transits    monthly_lake_level_2 intlake fac_year_3* fac_seas1, lag(4)
outreg2 using    Table_a4.xls, append ctitle(Tolls OLS year FE alt_FE_1) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_year_3* fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 transits fac_year_3* fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a4.xls, append ctitle(Tolls IV year FE alt_FE_1) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


* with year FE but broken down at the expansion point
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)
tab year_2 , gen(fac_year_2)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     transits    monthly_lake_level_2 intlake fac_year_2* fac_seas1
newey   transits    monthly_lake_level_2 intlake fac_year_2* fac_seas1, lag(4)
outreg2 using    Table_a4.xls, append ctitle(Tolls OLS year FE alt_FE_2) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_year_2* fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 transits fac_year_2* fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a4.xls, append ctitle(Tolls IV year FE alt_FE_2) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

*********************************************************************************

* Table A5. Alternative dry season- marginal value
* This is the marginal value of water in the lake
use "regression_data.dta", clear
tab season_2 , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)
gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92


reg     tolls monthly_lake_level_2 fac_112 fac_132                  fac_seas1
newey   tolls monthly_lake_level_2 fac_112 fac_132                  fac_seas1, lag(4)
outreg2 using Table_a5.xls, replace ctitle(OLS tolls) label addstat("F-statistic", e(F))

ivreg2 tolls fac_112  fac_132                  fac_seas1 ( monthly_lake_level_2 = m_1_lagged_rainfall_lake), endog( monthly_lake_level_2) robust bw(auto) small gmm2s
outreg2 using Table_a5.xls, append ctitle(IV tolls all) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

ivreg2 tolls fac_seas1 fac_year2 fac_year3 fac_year4 fac_year5 fac_year6 fac_year7 fac_year8 fac_year9 fac_year10 fac_year11 (monthly_lake_level_2 = m_1_lagged_rainfall_lake), endog( monthly_lake_level_2) robust bw(auto) small gmm2s
outreg2 using Table_a5.xls, append ctitle(Entire watershed) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

ivreg2 tolls fac_112  fac_132 dummy_preinvest1 fac_seas1 ( monthly_lake_level_2 = m_1_lagged_rainfall_lake), endog( monthly_lake_level_2) robust bw(auto) small gmm2s
outreg2 using Table_a5.xls, append ctitle(IV tolls all) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

*********************************************************************************

* Table A6. Alternative dry season- interaction term
use "regression_data.dta", clear
tab season_2 , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tolls    monthly_lake_level_2 intlake fac_112  fac_132 fac_seas1
newey   tolls    monthly_lake_level_2 intlake fac_112  fac_132 fac_seas1, lag(4)
outreg2 using    Table_a6.xls, replace ctitle(Tolls OLS) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_112  fac_132 fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a6.xls, append ctitle(Tolls IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


ivreg2 tonnage fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a6.xls, append ctitle(Tonnage IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

ivreg2 transits fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a6.xls, append ctitle(Transits IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

drop if time_trend_monthly > 92
ivreg2 transits fac_112 fac_132 fac_seas1 ( monthly_lake_level_2 = m_1_lagged_rainfall_lake ), endog( monthly_lake_level_2) robust bw(auto) small gmm2s
outreg2 using    Table_a6.xls, append ctitle(IV tolls pre) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

*********************************************************************************

* Table A7. Partial identificaqtion: This table is generated using R.


*********************************************************************************

* Table A8. Monthly FE and trade controls

* Monthly FE
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)
gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1
tab month , gen(fac_month)

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_112  fac_132 fac_month2 fac_month3 fac_month4 fac_month5 fac_month6 fac_month7 fac_month8 fac_month9 fac_month10 fac_month11 fac_month12
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_112 fac_132 fac_month2 fac_month3 fac_month4 fac_month5 fac_month6 fac_month7 fac_month8 fac_month9 fac_month10 fac_month11 fac_month12 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a8.xls, replace ctitle(Tolls IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

* Imports and export from the US
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)
gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_112  fac_132 fac_seas1 total_basics_ex consumer_goods_ex total_basics_im consumer_goods_im
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_112 fac_132 fac_seas1 total_basics_ex total_basics_im consumer_goods_im consumer_goods_ex (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a8.xls, append ctitle(Tolls IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

*********************************************************************************

* Table A9. Alternative instruments

* two lags of rainfall
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1


reg     monthly_lake_level_2 m_2_lagged_rainfall_lake fac_112  fac_132 fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_2_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a9.xls, replace ctitle(Tolls IV 2 lags) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 tonnage fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_2_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a9.xls, append ctitle(Tonnage IV 2 lags) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 transits fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_2_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a9.xls, append ctitle(Transits IV 2 lags) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))

* one lag of rainfall but over entire watershed
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1


reg     monthly_lake_level_2 m_1_lagged_rainfall_all fac_112  fac_132 fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_all intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a9.xls, append ctitle(Tolls IV watershed) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 tonnage fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_all intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a9.xls, append ctitle(Tonnage IV watershed) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 transits fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_all intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a9.xls, append ctitle(Transits IV watershed) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))



* one lag of rainfall over the lake and two lags of rainfall outside the lake
* This is the table with interaction term
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1


reg     monthly_lake_level_2 m_1_lagged_rainfall_lake m_2_lagged_rainfall_outside fac_112  fac_132 fac_seas1
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake m_2_lagged_rainfall_outside intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a9.xls, append ctitle(Tolls IV 1 and 2 lags) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 tonnage fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake m_2_lagged_rainfall_outside intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a9.xls, append ctitle(Tonnage IV 1 and 2 lags) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 transits fac_112 fac_132 fac_seas1 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake m_2_lagged_rainfall_outside intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a9.xls, append ctitle(Transits IV 1 and 2 lags) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


*********************************************************************************

* Table A10. Removing controls to see the effects of 2011 and 2013
* Keep fac_11
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tolls    monthly_lake_level_2 fac_112
newey   tolls    monthly_lake_level_2 fac_112, lag(4)
outreg2 using    Table_a10.xls, replace ctitle(Tolls OLS) label addstat("F-statistic", e(F))

reg     tolls    monthly_lake_level_2 intlake fac_112
newey   tolls    monthly_lake_level_2 intlake fac_112, lag(4)
outreg2 using    Table_a10.xls, append ctitle(Tolls OLS) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_132
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_112 (monthly_lake_level_2 = m_1_lagged_rainfall_lake), robust bw(auto) small gmm2s
outreg2 using    Table_a10.xls, append ctitle(Tolls IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 tolls fac_112 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a10.xls, append ctitle(Tolls IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))


* Keep fac_13
use "regression_data.dta", clear
tab season , gen(fac_seas)
tab dummy_price_11 , gen(fac_11)
tab dummy_price_13 , gen(fac_13)
tsset time_trend_monthly
tab year , gen(fac_year)

gen     dummy_preinvest1 = 0
replace dummy_preinvest1 = 1 if time_trend_monthly > 92
tab dummy_preinvest1 , gen(fac_preinvest)
gen intlake   = monthly_lake_level_2     * dummy_preinvest1

reg     tolls    monthly_lake_level_2 fac_132
newey   tolls    monthly_lake_level_2 fac_132, lag(4)
outreg2 using    Table_a10.xls, append ctitle(Tolls OLS) label addstat("F-statistic", e(F))

reg     tolls    monthly_lake_level_2 intlake fac_132
newey   tolls    monthly_lake_level_2 intlake fac_132, lag(4)
outreg2 using    Table_a10.xls, append ctitle(Tolls OLS) label addstat("F-statistic", e(F))

reg     monthly_lake_level_2 m_1_lagged_rainfall_lake fac_132
predict lake_hat, xb
gen intlake_hat   = lake_hat     * dummy_preinvest1

ivreg2 tolls fac_132 (monthly_lake_level_2 = m_1_lagged_rainfall_lake), robust bw(auto) small gmm2s
outreg2 using    Table_a10.xls, append ctitle(Tolls IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))
ivreg2 tolls fac_132 (monthly_lake_level_2 intlake = m_1_lagged_rainfall_lake intlake_hat), robust bw(auto) small gmm2s
outreg2 using    Table_a10.xls, append ctitle(Tolls IV) label addstat("Adjusted R-squared", e(r2_a), "F-statistic", e(F))







